<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
    <title>灵感库</title>
    <link rel="stylesheet" type="text/css" href="css/z-UI.tab.css"/>

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-table/jquery.table.js"></script>
    <link rel="stylesheet" href="js/jquery-table/css/jquery-table-default.css" />
    <link rel="stylesheet" href="js/jquery-table/css/jquery-table-admin.css" />
    <script type="text/javascript" src="js/jquery-table/jsrender.js"></script>

    <style>
		html,body{
            width: 100%;height: 100%;
            margin:0;background-color: white;
        }
        .zUI-bar .content .wrap { padding: 10px }
        .button { padding: 2px 10px; }
        .zUI-bar input{ padding: 5px  }

        .fileNameSpan {     display: inline-block;
            width: 200px;
        }
        .fileNameDown {  }
    </style>

</head>
<body  >
    <div style="width: 100%;height: 100%;overflow-y: auto;box-sizing: border-box;padding: 30px;display: inline-flex">
        <div style="margin: 5px;">
            <div class="zUI-bar line md" id="tab1">
                <div class="bar-box">
                    <div class="nav "  onclick="location.href = '/index.html'">
                        内容展示
                    </div>
                    <div class="nav " onclick="location.href = '/tag.html'">
                        标签管理
                    </div>
                    <div class="nav" onclick="location.href = '/category.html'">
                        分类管理
                    </div>
                    <div class="nav" onclick="location.href = '/content.html'">
                        内容管理
                    </div>
                    <div class="nav active" onclick="location.href = '/system.html'">
                        系统管理
                    </div>
                </div>
                <div class="content">
                    <div id="backupDiv" >
                    </div>
                </div>
            </div>
        </div>
    </div>

<script>
    $.ajax({
        url :  '/system/backup/list',
        dataType: 'json',
        success : function(data) {
            if(!data.list) {
                return;
            }

            $('#backupDiv').html('');
            for (let i = 0; i < data.list.length; i++) {
                var name = data.list[i].trim();
                $('#backupDiv').append('<div class="backupItem">' +
                    '                        <span class="fileNameSpan">'+name+'</span>' +
                    // '                        <button class="fileNameDown" onclick="downBackup(\''+name+'\')">下载</button>' +
                    '                        <a class="fileNameDown" href="/system/backup/down?fileName='+name+'">下载</a>' +
                    '                  </div>');
            }
        }
    });

    // function downBackup(filename) {
    //     $.ajax({
    //         url :  '/system/backup/down?fileName=' + filename,
    //
    //     });
    // }
</script>
</body>
</html>